<?php
jimport( 'joomla.application.component.model' );
class MallkitComponentModel extends JModel
{
	var $_table = '#__mallkit';
	function &getTable()
	{
		if ($this->_table == null) {
			$this->_table = JTable::getInstance('component', $this->getDBO() );
		}
		return $this->_table;
	}
	function &getParams()
	{
		static $instance;

		if ($instance == null)
		{
			$table = &$this->getTable();
			$option = preg_replace( '#\W#', '', $table->option );
			$path = JPATH_ADMINISTRATOR . '/components/' . $option . '/config.xml';
			if (file_exists( $path ))
			{
				$instance = new JParameter( $table->params, $path );
			}
			else
			{
				$instance = new JParameter( $table->params );
			}
		}
		return $instance;
	}
}
?>
